package Table;


import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import java.awt.BorderLayout;
import java.util.Vector;

import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;

import danhmuc.HangHoa;
import form.DSJ_HangHoa;
import form.DSJ_KhachHang;


public class THangHoa extends JPanel {
	
	public THangHoa(HangHoa HangHoa) {
		DSJ_HangHoa b = new DSJ_HangHoa();
		Vector<DSJ_HangHoa> list = b.getUsers();
		Vector<String> columns = new Vector<String>();
		columns.add("Mã HH");
		columns.add("Loại Mặt Hàng");
		columns.add("Tên Hàng Hóa");
		columns.add("Đơn Vị Tính");
		columns.add("Số Lượng");
		columns.add("Đơn Giá Mua");
		columns.add("Đơn Giá Bán");
		
		JScrollPane scrollPane = new JScrollPane();
		JTable table = new JTable(list,columns);
		
		//kich thuoc
		
		TableColumn col = table.getColumnModel().getColumn(0);		col.setPreferredWidth(100);
		TableColumn col1 = table.getColumnModel().getColumn(1);		col1.setPreferredWidth(200);
		TableColumn col2 = table.getColumnModel().getColumn(2);		col2.setPreferredWidth(300);
		TableColumn col3 = table.getColumnModel().getColumn(3);		col3.setPreferredWidth(150);
		TableColumn col4 = table.getColumnModel().getColumn(4);		col4.setPreferredWidth(150);
		TableColumn col5 = table.getColumnModel().getColumn(5);		col5.setPreferredWidth(200);
		TableColumn col6 = table.getColumnModel().getColumn(6);		col6.setPreferredWidth(200);
		
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		setLayout(new BorderLayout(0, 0));
		scrollPane.setViewportView(table);
		add(scrollPane);
		
		
		
	

	
	}
}
